<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="myTags" tagdir="/WEB-INF/tags/components" %>
<%@ tag language="java" pageEncoding="ISO-8859-1"%>
<%@ attribute name="post" required="true" type="beans.Post" rtexprvalue="true" %>

<!-- Author: Minh-Tuan Ta -->

<div class="post">
	<div class="postTitle"><a class="postDDTrigger" href="#">${post.contentTitle }</a></div>
	<div class="postDD">
		<div class="postContent">${post.content }</div>
		<div class="postDateCreated">${post.formattedDateCreatedString }</div>
		<div class="postRatings" title="Post Rating">
			<span class="helpful">${post.numHelpful } <img src="images/icons/thumb-up.gif"/></span>
			<form action="Rate" method="post">
				<input type="submit" src="images/icons/thumb-up.gif" name="rateValue"  value="Helpful" />
				<input type="hidden" name="contentID" value="${post.contentID }" />
			</form>
			<span class="notHelpful">${post.numNotHelpful } <img src="images/icons/thumb-down.gif"/></span>
			<form action="Rate" method="post">
				<input type="hidden" name="contentID" value="${post.contentID }" />
				<input type="submit" name="rateValue" value="Not Helpful">
			</form>
			Will you rate this post?<br />
			
		</div>
		<c:if test="${post.userID == User.userID}">
			<span class="linkButton"><a href="UpdatePost?postID=${post.contentID }">Update Post</a></span>
			<form action="DeletePost" method="post">
				<input type="hidden" name="postID" value="${post.contentID }" />
				<input type="submit" name="submit" value="Delete Post" />
			</form>
		</c:if>
	</div>
	<div class="postComment">
		<ul class="postCommentList">
			<c:forEach var="comment" items="${post.comments }">

				<myTags:Comment comment="${comment }"></myTags:Comment>

			</c:forEach>
		</ul>
		<form action="CreateComment" method="post">
			<span>Comment</span><br />
			<input type="text" name="commentContent" /><br />
			<input type="hidden" name="postID" value="${post.contentID }" />
			<input type="submit" name="submit" value="Comment" />
		</form>
	</div>
</div>

